home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ADA Programming Guide
/
ADA Programming Guide.iso
/
adatutor
/
lrmrdr
/
chapac.doc
< prev
next >
Wrap
Text File
|
1996-01-30
|
13KB
|
395 lines
The following document is a draft of the corresponding chapter of the
version of the Ada Reference Manual produced in response to the Ansi
Canvass. It is given a limited circulation to Ada implementers and to
other groups contributing comments (according to the conventions defined in
RRM.comments). This draft should not be referred to in any publication.
ANSI-RM-C-v23 - Draft Chapter
C Predefined Language Environment
version 23
83-02-11
This version has addressed all comments up to #5795
> C. Predefined Language Environment
This annex outlines the specification of the package STANDARD containing
all predefined identifiers in the language. The corresponding package body
is implementation-defined and is not shown.
The operators that are predefined for the types declared in the package
STANDARD are given in comments since they are implicitly declared. Italics
are used for pseudo-names of anonymous types (such as universal_real) and
for undefined information (such as implementation_defined and
any_fixed_point_type).
package STANDARD is
type BOOLEAN is (FALSE, TRUE);
-- The predefined relational operators for this type are as follows:
-- function "=" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function "/=" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function "<" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function "<=" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function ">" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function ">=" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- The predefined logical operators and the predefined logical negation operator are as follows:
-- function "and" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function "or" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function "xor" (LEFT, RIGHT : BOOLEAN) return BOOLEAN;
-- function "not" (RIGHT : BOOLEAN) return BOOLEAN;
-- The universal type universal_integer is predefined.
type INTEGER is IMPLEMENTATION_DEFINED;
-- The predefined operators for this type are as follows:
-- function "=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
-- function "/=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
-- function "<" (LEFT, RIGHT : INTEGER) return BOOLEAN;
-- function "<=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
-- function ">" (LEFT, RIGHT : INTEGER) return BOOLEAN;
-- function ">=" (LEFT, RIGHT : INTEGER) return BOOLEAN;
-- function "+" (RIGHT : INTEGER) return INTEGER;
-- function "-" (RIGHT : INTEGER) return INTEGER;
-- function "abs" (RIGHT : INTEGER) return INTEGER;
-- function "+" (LEFT, RIGHT : INTEGER) return INTEGER;
-- function "-" (LEFT, RIGHT : INTEGER) return INTEGER;
-- function "*" (LEFT, RIGHT : INTEGER) return INTEGER;
-- function "/" (LEFT, RIGHT : INTEGER) return INTEGER;
-- function "rem" (LEFT, RIGHT : INTEGER) return INTEGER;
-- function "mod" (LEFT, RIGHT : INTEGER) return INTEGER;
-- function "**" (LEFT : INTEGER; RIGHT : INTEGER) return INTEGER;
-- An implementation may provide additional predefined integer types.
It is recommended that -- the names of such additional types end with
INTEGER as in SHORT_INTEGER or LONG_INTEGER. -- The specification
of each operator for the type universal_integer, or for any
additional -- predefined integer type, is obtained by replacing
INTEGER by the name of the type in the -- specification of the
corresponding operator of the type INTEGER, except for the right --
operand of the exponentiating operator.
-- The universal type universal_real is predefined.
type FLOAT is IMPLEMENTATION_DEFINED;
-- The predefined operators for this type are as follows:
-- function "=" (LEFT, RIGHT : FLOAT) return BOOLEAN;
-- function "/=" (LEFT, RIGHT : FLOAT) return BOOLEAN;
-- function "<" (LEFT, RIGHT : FLOAT) return BOOLEAN;
-- function "<=" (LEFT, RIGHT : FLOAT) return BOOLEAN;
-- function ">" (LEFT, RIGHT : FLOAT) return BOOLEAN;
-- function ">=" (LEFT, RIGHT : FLOAT) return BOOLEAN;
-- function "+" (RIGHT : FLOAT) return FLOAT;
-- function "-" (RIGHT : FLOAT) return FLOAT;
-- function "abs" (RIGHT : FLOAT) return FLOAT;
-- function "+" (LEFT, RIGHT : FLOAT) return FLOAT;
-- function "-" (LEFT, RIGHT : FLOAT) return FLOAT;
-- function "*" (LEFT, RIGHT : FLOAT) return FLOAT;
-- function "/" (LEFT, RIGHT : FLOAT) return FLOAT;
-- function "**" (LEFT : FLOAT; RIGHT : INTEGER) return FLOAT;
-- An implementation may provide additional predefined floating
point types. It is -- recommended that the names of such
additional types end with FLOAT as in SHORT_FLOAT or -- LONG_FLOAT.
The specification of each operator for the type universal_real, or
for any -- additional predefined floating point type, is obtained
by replacing FLOAT by the name of -- the type in the specification of
the corresponding operator of the type FLOAT.
-- In addition, the following operators are predefined for universal
types:
-- function "*" (LEFT : universal_integer; RIGHT : universal_real) return universal_real;
-- function "*" (LEFT : universal_real; RIGHT : universal_integer) return universal_real;
-- function "/" (LEFT : universal_real; RIGHT : universal_integer) return universal_real;
-- The type universal_fixed is predefined. The only operators declared for this type are
-- function "*" (LEFT : any_fixed_point_type; RIGHT : any_fixed_point_type) return universal_fixed;
-- function "/" (LEFT : any_fixed_point_type; RIGHT : any_fixed_point_type) return universal_fixed;
-- The following characters form the standard ASCII character
set. Character literals -- corresponding to control characters are
not identifiers; they are indicated in italics in -- this
definition.
type CHARACTER is
(nul, soh, stx, etx, eot, enq, ack, bel,
bs, ht, lf, vt, ff, cr, so, si,
dle, dc1, dc2, dc3, dc4, nak, syn, etb,
can, em, sub, esc, fs, gs, rs, us,
' ', '!', '"', '#', '$', '%', '&', ''',
'(', ')', '*', '+', ',', '-', '.', '/',
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', ':', ';', '<', '=', '>', '?',
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', '[', '\', ']', '^', '_',
'`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', '{', '|', '}', '', del);
for CHARACTER use -- 128 ASCII character set without holes
(0, 1, 2, 3, 4, 5, ..., 125, 126, 127);
-- The predefined operators for the type CHARACTER are the same as for any enumeration type.
package ASCII is
-- Control characters:
NUL : constant CHARACTER := NUL; SOH : constant CHARACTER := SOH;
STX : constant CHARACTER := STX; ETX : constant CHARACTER := ETX;
EOT : constant CHARACTER := EOT; ENQ : constant CHARACTER := ENQ;
ACK : constant CHARACTER := ACK; BEL : constant CHARACTER := BEL;
BS : constant CHARACTER := BS; HT : constant CHARACTER := HT;
LF : constant CHARACTER := LF; VT : constant CHARACTER := VT;
FF : constant CHARACTER := FF; CR : constant CHARACTER := CR;
SO : constant CHARACTER := SO; SI : constant CHARACTER := SI;
DLE : constant CHARACTER := DLE; DC1 : constant CHARACTER := DC1;
DC2 : constant CHARACTER := DC2; DC3 : constant CHARACTER := DC3;
DC4 : constant CHARACTER := DC4; NAK : constant CHARACTER := NAK;
SYN : constant CHARACTER := SYN; ETB : constant CHARACTER := ETB;
CAN : constant CHARACTER := CAN; EM : constant CHARACTER := EM;
SUB : constant CHARACTER := SUB; ESC : constant CHARACTER := ESC;
FS : constant CHARACTER := FS; GS : constant CHARACTER := GS;
RS : constant CHARACTER := RS; US : constant CHARACTER := US;
DEL : constant CHARACTER := DEL;
-- Other characters:
EXCLAM : constant CHARACTER := '!'; QUOTATION : constant CHARACTER := '"';
SHARP : constant CHARACTER := '#'; DOLLAR : constant CHARACTER := '$';
PERCENT : constant CHARACTER := '%'; AMPERSAND : constant CHARACTER := '&';
COLON : constant CHARACTER := ':'; SEMICOLON : constant CHARACTER := ';';
QUERY : constant CHARACTER := '?'; AT_SIGN : constant CHARACTER := '@';
L_BRACKET : constant CHARACTER := '['; BACK_SLASH : constant CHARACTER := '\';
R_BRACKET : constant CHARACTER := ']'; CIRCUMFLEX : constant CHARACTER := '^';
UNDERLINE : constant CHARACTER := '_'; GRAVE : constant CHARACTER := '`';
L_BRACE : constant CHARACTER := '{'; BAR : constant CHARACTER := '|';
R_BRACE : constant CHARACTER := '}'; TILDE : constant CHARACTER := '';
-- Lower case letters:
LC_A : constant CHARACTER := 'A';
...
LC_Z : constant CHARACTER := 'Z';
end ASCII;
-- Predefined subtypes:
subtype NATURAL is INTEGER range 0 .. INTEGER'LAST;
subtype POSITIVE is INTEGER range 1 .. INTEGER'LAST;
-- Predefined string type:
type STRING is array(POSITIVE range <>) of CHARACTER;
pragma PACK(STRING);
-- The predefined operators for this type are as follows:
-- function "=" (LEFT, RIGHT : STRING) return BOOLEAN;
-- function "/=" (LEFT, RIGHT : STRING) return BOOLEAN;
-- function "<" (LEFT, RIGHT : STRING) return BOOLEAN;
-- function "<=" (LEFT, RIGHT : STRING) return BOOLEAN;
-- function ">" (LEFT, RIGHT : STRING) return BOOLEAN;
-- function ">=" (LEFT, RIGHT : STRING) return BOOLEAN;
-- function "&" (LEFT : STRING; RIGHT : STRING) return STRING;
-- function "&" (LEFT : CHARACTER; RIGHT : STRING) return STRING;
-- function "&" (LEFT : STRING; RIGHT : CHARACTER) return STRING;
-- function "&" (LEFT : CHARACTER; RIGHT : CHARACTER) return STRING;
type DURATION is delta IMPLEMENTATION_DEFINED range IMPLEMENTATION_DEFINED;
-- The predefined operators for the type DURATION are the same as for any fixed point type.
-- The predefined exceptions:
CONSTRAINT_ERROR : exception;
NUMERIC_ERROR : exception;
PROGRAM_ERROR : exception;
STORAGE_ERROR : exception;
TASKING_ERROR : exception;
end STANDARD;
Certain aspects of the predefined entities cannot be completely described
in the language itself. For example, although the enumeration type BOOLEAN
can be written showing the two enumeration literals FALSE and TRUE, the
short-circuit control forms cannot be expressed in the language.
Note:
The language definition predefines the following library units:
- The package CALENDAR (see 9.6)
- The package SYSTEM (see 13.7)
- The package MACHINE_CODE (if provided) (see 13.8)
- The generic procedure UNCHECKED_DEALLOCATION (see 13.10.1)
- The generic function UNCHECKED_CONVERSION (see 13.10.2)
- The generic package SEQUENTIAL_IO (see 14.2.3)
- The generic package DIRECT_IO (see 14.2.5)
- The package TEXT_IO (see 14.3.10)
- The package IO_EXCEPTIONS (see 14.5)
- The package LOW_LEVEL_IO (see 14.6)